// pages/singer/index.js
import pinyin from "wl-pinyin"
Component({
  /**
   * 组件的属性列表
   */
  
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
list:null,

  },

  /**
   * 组件的方法列表
   */

  methods: {
    
    bbc(id){
      var bb=pinyin.getFirstLetter(id) // NH
    return bb.split('')[0]
    },
    showsinger(){
      wx.request({
        url: 'http://tea.hhp.im/top/artists?offset=0&limit=100',
        method:'GET',
        success:(res)=>{
let list=[...res.data.artists.map(item=>{
  return item
})]
var music=["A","B","C","D","E","F","G","H","Y","J","K","L","N","M","O","P","Q","R","S","T","V","W","S","Y","Z"]
var mud=music.map(item=>{
  return{
arr:item,
bb:list.filter(o=>this.bbc(o.name)==item)
  }
})

this.setData({
  list:mud
})
        }
      })
    },
    sin_btn(e){
      let {index}= e.currentTarget.dataset;
      wx.navigateTo({
        url:"/pages/songitem/index?id="+index
      })
    
    }
  }
  
})
